from django.db import models



# Create your models here.
class userInfo(models.Model):
    username = models.CharField(max_length=255,unique=True,null=False)
    password = models.CharField(max_length=255,null=False)
    biography = models.TextField()

class track(models.Model):
    title = models.CharField(max_length=255, null=False)
    duration = models.IntegerField(null=False)

class playRecord(models.Model):
    play_date = models.DateField(auto_now_add=True,null=False)
    play_times = models.IntegerField(default=1,null=False)
    track_id = models.ForeignKey(track,on_delete=models.CASCADE,related_name='playRecord')
    user_id = models.ForeignKey(userInfo,on_delete=models.CASCADE,related_name='playRecord')